package com.lcy.proto.client;


import com.google.protobuf.ServiceException;
import com.lcy.proto.rpc.MathService;
import com.lcy.proto.rpc.Params;
import com.lcy.proto.rpc.Result;

import java.io.IOException;

/**
 * @author loucy
 * @version 1.0
 */
public class Client {
    public static void main(String[] args) throws ServiceException, IOException {
        MathService.BlockingInterface service = MathService.newBlockingStub(new ClientBlockingRpcChannel("192.168.1.40", 12356));
        Params params = Params.newBuilder()
                .setParam1(10)
                .setParam2(8)
                .build();
        Result result = service.add(null, params);
        System.out.println(result);
        result =service.sub(null,params);
        System.out.println(result);
    }
}
